package com.crm.mapper;

import com.crm.pojo.client;

import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface clientMapper {
    // 查询所有
    @Select("SELECT * from client where uid=#{uid}")
    List<client> selectAllByUid(Integer uid);
    //查询所有(根据uid)---分页查询
    List<client> selectByPage(@Param("uid") Integer uid,@Param("currentPage") Integer currentPage,@Param("pageSize") Integer pageSize);
    /*问题1：因没加@Param注释，出现方法错误的问题*/


    @Select("select * from client where cid=#{cid}")
    client selectByCid(Integer cid);

    @Update("update client set company=#{company},sort=#{sort},address=#{address},description=#{description} where cid=#{cid}")
    boolean updateByCid(client client);

    @Delete("delete from client where cid=#{cid}")
    boolean deleteByCid(Integer cid);

    @Insert("INSERT INTO client(uid, company, sort, address,description) values (#{uid},#{company},#{sort},#{address},#{description})")
    boolean add(client client);

    int deleteByIds(@Param("ids") int[] ids);
}
